# 查找GTest包
find_package(GTest REQUIRED)

# 设置测试代码目录
aux_source_directory(../test DIR_TEST)

# 生成测试可执行文件
add_executable(test_CMakeProject1 ${DIR_TEST})

# 根据不同平台设置特定的链接库
if(WIN32)
    # Windows平台特定设置
    set(LIB_PATH ${PROJECT_SOURCE_DIR}/build/src/Debug)
    set(link_lib glogd gtest jsoncpp ${LIB_PATH}/my54library.lib)
else()
    # Linux平台特定设置
    set(LIB_PATH ${PROJECT_SOURCE_DIR}/lib)
    set(link_lib glog gtest pthread gflags jsoncpp ${LIB_PATH}/libmy54library.so)
endif()

# 链接库
target_link_libraries(test_CMakeProject1 ${link_lib})
add_dependencies(test_CMakeProject1 my54library) # 设置依赖关系,不然make -j并行编译会出错
